'use strict'

class template {
    constructor() {
        this.param = '/:id'
    }
    //创建资源
    async get(c) {
        //根据贴纸id获取具体贴纸信息
        var template_id = c.param.id;
        try {
            let sqltext1 = `select * `
                + ` from template WHERE template_id = ${template_id}`
            var r1 = await c.service.psql.query(sqltext1);
            if (r1.rowCount == 0) {
                return c.send('template not exists');
            }
            else{
                return c.send(r1.rows[0]);
            }
        }
        catch (err) {
            console.log(err);
            return c.status(500).send('error');
        }
    }
}

module.exports = template